/****************************************************************
 * <strong>MFAOPLog</strong>
 *
 * <p>
 * MFAOPLog
 * </p>
 *
 * @author AndyZhang 2011 cnet2001@163.com
 * @version 0.1
 * ToDo:
 ***************************************************************/

package com.thinkwide.data.aop;

import com.thinkwide.data.debug.MFDebug;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MFAOPLog implements InvocationHandler {
    private Object delegate;

    public MFAOPLog(Object delegate) {
        this.delegate = delegate;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Object data = null;
        try {
            MFDebug.println("start：" + method.getName());
            data = method.invoke(delegate, args);
            MFDebug.println("afret：" + method.getName());
        } catch (Exception e) {
            MFDebug.println("Error:%s", e.getMessage());

        }
        return data;
    }
}
